/*
ID: icerupt1
PROG: rockers
LANG: C++11
*/

/* solution
 *
 *
 *
*/
#include <fstream>
#include <iostream>

std::ifstream fin {"rockers.in" };
std::ofstream fout{"rockers.out"};

int const maxn = 22;
int f[maxn][maxn][maxn];
int da[maxn];
int n, t, m;

int main()
{
	fin >> n >> t >> m;
	for (int i = 1; i <= n; i++) fin >> da[i];
	for (int i = 1; i <= m; i++)
		for (int j = 1; j <= n; j++)
			for (int k = 0; k <= t; k++) {
				f[i][j][k] = std::max(std::max(f[i][j-1][k], f[i-1][j-1][t]),
						f[i-1][j][t]);
				if (k >= da[j]) f[i][j][k] = std::max(f[i][j][k],
						f[i][j-1][k-da[j]] + 1);
			}
	std::cout << f[m][n][t] << '\n';
	fout << f[m][n][t] << '\n';
}

